package com.peng.design.visitor;

import java.util.Arrays;

/**
 * Unit
 *
 * @author: lupeng10
 * @create: 2023-06-08 14:21
 */
public abstract class Unit {

    private final Unit[] children;

    public Unit(Unit... children) {
        this.children = children;
    }

    public void accept(UnitVisitor visitor) {
        Arrays.stream(children).forEach(u -> u.accept(visitor));
    }

}
